@use '../../_styles/mixin.scss' as *;
@use './var.scss';

.o-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--toggle-size);
  max-width: var(--toggle-max-width);
  min-width: var(--toggle-min-width);
  padding: var(--toggle-padding);
  transition: all var(--o-duration-s) var(--o-easing-standard);
  background-color: var(--toggle-bg-color);
  border: 1px solid var(--toggle-bd-color);
  white-space: nowrap;
  border-radius: var(--toggle-radius);
  cursor: pointer;

  @include hover {
    color: var(--toggle-color-hover);
    background-color: var(--toggle-bg-color-hover);
    border: 1px solid var(--toggle-bd-color-hover);
  }

  &:active {
    color: var(--toggle-color-active);
    background-color: var(--toggle-bg-color-active);
    border: 1px solid var(--toggle-bd-color-active);
  }
}

.o-toggle-checked {
  background-color: var(--toggle-bg-color-checked);
  color: var(--toggle-color-checked);
  border: 1px solid var(--toggle-bd-color-checked);

  @include hover {
    color: var(--toggle-color-checked-hover);
    background-color: var(--toggle-bg-color-checked-hover);
    border: 1px solid var(--toggle-bd-color-checked-hover);
  }

  &:active {
    color: var(--toggle-color-checked-active);
    background-color: var(--toggle-bg-color-checked-active);
    border: 1px solid var(--toggle-bd-color-checked-active);
  }
}

.o-toggle-disabled {
  &,
  &:hover,
  &.active {
    cursor: not-allowed;
    color: var(--toggle-color-disabled);
    background-color: var(--toggle-bg-color-disabled);
    border-color: var(--toggle-bd-color-disabled);
  }
}

.o-toggle-checked.o-toggle-disabled {
  &,
  &:hover,
  &.active {
    color: var(--toggle-color-checked-disabled);
    background-color: var(--toggle-bg-color-checked-disabled);
    border-color: var(--toggle-bd-color-checked-disabled);
  }
}

.o-toggle-prefix {
  display: inline-flex;
  align-items: center;
  font-size: var(--toggle-icon-size);
  margin-right: var(--toggle-gap);
}
